import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.data.ACL;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * @ClassName ZKNodeOperator
 * @Description TODO
 * @Author BossZ
 * @Version 1.0
 * @Date 2019/1/15-18:26
 **/
public class ZKNodeGet  implements Watcher {

    private ZooKeeper zooKeeper;

    public static final Logger log  = LoggerFactory.getLogger(ZKNodeGet.class);
    public ZKNodeGet() {
    }

    public ZKNodeGet(String connectString) {
        try {
            zooKeeper = new ZooKeeper(connectString,200,(e)->{
                log.info("-----"+e.getState().name());
            });
        } catch (IOException e) {
            e.printStackTrace();
        }
    }



    public static void main(String[] args) throws Exception{
        ZKNodeGet znode = new ZKNodeGet(Main.zkServerPath);

//        znode.getZooKeeper().getData("")

    }

    public ZooKeeper getZooKeeper() {
        return zooKeeper;
    }

    public void setZooKeeper(ZooKeeper zooKeeper) {
        this.zooKeeper = zooKeeper;
    }

    @Override
    public void process(WatchedEvent watchedEvent) {

    }
}
